package com.heima.wemedia.config;

import com.heima.wemedia.interceptor.WmTokenIntercetor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    /**
     * 添加自定义拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /* 注册自己写的拦截器， addPathPatterns("/**") 指定要拦截的请求*/
        registry.addInterceptor(new WmTokenIntercetor()).addPathPatterns("/**")
                .excludePathPatterns("/login/**");
    }
}
